Re-factor Undo/Redo functionality

fixes #62 
Signed-off-by: Harsh Gupta <gupta.harsh96@gmail.com>