made destructor more efficient