add encode operation