Canonical order function