refactored Search functionality;