Split up API and Operation sorters and modified them to take functions rather than strings.