Refactor makeRequest() to be less ugly