Refactor searchbox