Sketched outline of rangeDecoder