Fixes to conversion
Changed some counters to uint8_t
Some cleanup