Well, you've chosen a "solution" that will most often use more system resources and require more code be maintained than if you'd have used the method Robert suggested. . .
Your "subject" mentions SEARCH, but your last post mentions "perform varying".
Alright. I already figured it out again by myself.
If you are going to prefer your learning-attempt solutions over experienced suggestions you might want to spend much more time on "your" solution and not be bothered by our suggestions that for whatever reason you prefer not to use. . .