Fixed up functionality for search route