Added Counter for max iterations