refactor search example