changed listy to while loop