Fixed a few bugs and implemented undo/redo for remove item.