added {} for the while loop