Cleaning up delete() function