cleaned delete button function