added encode example