Adding an if exists to the delete functions