Moving common destructor code to base class.
More refactoring.