added more ways to hide navigation bar
clean up code