Added debug menu and various other fixes.