some monte carlo simulations. beware - ugly spaghetticode everywhere