Begin refactoring menu script.