fixed CHARCOUNT bug (was one greater than it should be)
fixed various permutation encoding bugs, and have it basically
working now.  permutation decoding yet to come.