Working bbsim with some changes from the MPI branch