Changed auto_ptr to unique_ptr