Changed encode definition