move URL request into own function