broke code down into map.js and main.js