changing to unique_ptr