refactor nav js