refactored NSURLConnection part