Fixed double-updating particles.
Added a undohandler.