added checksum function