refactor RefCountedTyped