Added a checksum function.