refactored navigation into function to be included