revamped setView logic and did major cleanup of map.js