If so inclined, you could extract the `bytes.rewind()` and `size = byte.limit` lines outside of the if statements.