utils: Move refcounting into Sequence class