Cleaned up and fixed some of the MPI code.