Working delete function.