Code cleanup and improved menu bar