add timeouts and error handling