adjusting code from maps.js to search.js