http connection timeouts, futher refactoring