adding timeout handling