Introduce while loop and counter