use unique_ptr to pass pointers