adds error handling for connection timeouts, closes #40, closes #27