make MAXIteration & Threshold as arguments