finally got delete function to work