encode impl complete