added crc and hamming encoder to encode method and changed some private variables