_rules: sort functions