fixing and refactoring navigation