working on monte carlo codes