refactoring cell and menu display logic