Tested and bug free for mpiRead and main