Enhanced checksum logic