Refactored pushState to fix problems with back-forward navigation and popState firing on load