unique_ptr for new exception safety