refactored code to attach search box