the encode function yields now result as in the original program