Changed destructor to function and pointer