Tidy up.
Added debug memory checking.
Removed useless setRoot().
Moved virtual functions out-of-line.
Moved virtual functions out-of-line.
Changed completely wrong explicit destructor call to clear().