Added rudimentary tests. Fixed decoding of data not mod 8.