added debug msg and added an undo function to delete last selected item
merged