removed duplicate and unnecessary id from search box
fixed infinite loop on location change by using  instead of window.location, also formatted code indentation for readability