Refactored the Search view and controller, code cleanup