Added option to choose number of threads. Apparently necessary since
program with 2 threads runs faster than with 4 threads - at least
on my Mac Mini. Other minor cleanup.