Improve temporary memory usage: Use an unique_ptr for that purpose