change searching algorithm and get a 96% performance improvement
remove useless code