search and refactor