Replaced auto_ptr with unique_ptr