eliminated the while(1)