simplified encode