Sort the main menu tree