mpi merge continued. todo: extern-alize arrays local gathered and put calls in function, call function from main