add clear to base, move code from destructor