refactored code works for all menu items