refactoring to search spec