Refactoring map js
Adding history to the map page
Preserving state on navigating away from page