use unique_ptr instead of new/delete