Grouped API response chunks of code in functions to clean up the mess a bit