MPI integration and few tweaks

I haven't test it yet. :P
Please take a look. Thanks.