search alg. refactored...