updated delete to delete tasks. It also updates tempList if there is more than one possible task.