Replaced shared_ptr to unique_ptr if possible.