changed position of while