Added a toggle mesh menu item and refactored some more