Refactored the Nav bar code