Refactored code to get response from Google