fixed major menu problem

re-design of the code to fix a major menu display problem.