Add a version of MPI_InitFinalize that adaptively determines the number of threads.
Rework some of the code. Indent it.