refactored menu generation