Updated encoding part