halfway through implementing the undo.

logic implemented, but the testcases are not concrete

Signed-off-by: Nicholas Lum <nicholaslum444@hotmail.com>