Add delete at end of function