Sorting and trimming of recents array is finally working