Simplified while loop as a with statement
Merge pull request #1 from tomschr/master

thanks.