Added onUndo callback. Fixes #216.