added iteration and time limit