Refactor menu building.