turned test while loop into sort of a do-while loop