refactored search feature