slightly modified monte_carlo