new encoding implementation