Implemented the destructor.