TODO: Handle errors other than 404 Not Found.
Separate out functions/structs/constants/globals to properly named files.