update encoder code