Simplified while loop as a with statement