Fixed search functionality and added validations