removed zero case in while loop