Wrote logic for checking checksum