transcode refactor