Fixed persistent undo. Some indentation cleanup.