MPI version working as expected - needs clean up and optimization