adjusted deleteItem function and cleaned up updateItem code