updated while loops

updated while loops