Adding P10 - encode function