altered destructor code