And I've just noticed that I could have moved all those $EmailNeeded = 1 statements to one single statement in the last IF statement of the WHILE loop.