refactored nav func