Added encoding fn.