Updated the plot and moved the delete function