ADAM so DUMB I FIXED IT THO

Just added back the writing to database code that adam accidentally
deleted