changing the while test for cleaner code