Split this into two methods so that it would be possible to have interface covering standard reference iterator and branch iterator

type RefIterator interface {
    Next() (*Reference, error)
}

This would allow things like channel based iteration to be moved to functions that operate on the interface instead of reimplementing. RefIterator would be a bad name considering there is a struct ReferenceIterator already. Not sure what naming should be if we do that, but seems like a good case for interface.