converting to canonical format