Refactoring some MonteCarlo functionality