added iterative checking errors and printing