Use sort_by instead of sort{}