refactoring searches controller