updated getFoldersSorted