cleanup stupid while loop