Added timeout handling.