added bitwise encoding