Added proper functionality to search