switch to using `sort_by`