Added connection check and timeout settings