using sort keys instead of sorting by id