much cleaner way of handling connection timeouts