Revisions to logic, NOT WORKING, but have next steps wireframed in with comments. Preformat JSON object before passing into write_to_database function.