fixed bug in search method and got rid of domain-specific knowledge.