These two can be merged to the more efficient:

    require(instanceLength.isEmpty || instanceLength.get > lastByte, "instanceLength must be empty or > lastByte)

Since `lastByte` is always >= 0 here we can drop the >= 0 check completely.