finalizing canonicalize routine structure