move canonicalization, write canonical representations to output