moderate modification of function to compute the checksum.