Added sort index calculation to sync and upload units