refactor menu into class pattern