added validation and checksum calculation