removed third argument particleSize in optimizethreadspace