search refactoring and UI improvements