implemented destructor.