Code cleanup for menu logic