Added iterations as a parameter and limited bin number to 100