Streamlined some while loops that previously had manual breaks; they use a do-while structure now.