changed search box feature to be more robust and modular