Minor improvement to menu bar control code