refactored menu functions