refactored helpers/sorting.sort_by_ to handle descending and ascending variations