refactor and improve pushstate routing