Major code cleanup (game+editor) and minor fixes