Partly fixed original MPI implementation (can work, but memory leak crashes run often)