stuff for SD calculation for download.aggregate