more bit encoding improvements