fixing and refactoring navigation. Navigation works