Refactoring searchwindow