Improved the way it sorts and invert the rows, for views and _all_docs