Replace RefCounter capability with std::shared_ptr if possible