Refactor handling of packet headers

Refactored ackDataHasAVaildHeader:
 -shared.Header is used as necessary
 -avoided slicing wherever possible
 -remove trailing null characters when comparing command strings
 -don't calculate the checksum of a large payload