refactoring menu.c