added MPI support and replaced .write with a stream
added MPI support and replaced .write with a stream