Making the crc16 calculation a function.