Fix menu levels and tidy up the code

The maxDepth is 1 increased at some line. It cause for the problem of
exceeding the expected level's number.
Merge pull request #148 from midishero/v4

Fix menu levels and tidy up the code