Comments and fixed leftover bytes handling.
Fixed remaining bytes calculation (it was off by one byte)