We should probably just encapsulate this logic into a function, e.g. `sort_by = format_sort(sort_by)`