Added the delete function with dialog