Added c++ delete function and tests