refined the behaviour of the navigation menu