Changing IF to WHILE

For continuous validation: Changing IF to WHILE