Refactored query segment OrderBy to represent each ordered function as an OrderedFunction class