Refactor search bar