added logic to the nav bar