corrected threads calculation and chunks output