how about putting the work in this block in the above while loop?