Major cleanup on the editor