changed modes of all files and added mpi reduce code