use unique_ptr instead of raw pointer