corrected a syntax error, and switched a while to until, reads better