cleaned up delete button function