Simplify menu-related code a bit