refactor transcode