Slightly changed toByte and fromByte