fix reverseSortBy
add functions for going from array to dict