Commented MPI part of code and moved functions for better readability