parameterize thread counts.  improve comments