Simplify and improve navigation bar code.