change while loop to a do while, and changed logic. 
Initiated usec variable in timeout.