Bits and bobs of ported code for transcoding.