added fucntion to the second mpi stage