Replaced Ref and RefCounter with std::shared_ptr<>