Adds a delete function for trees