Cleaned up database code

And changed communication type with the callback function
Also made the tables not dropped every time we re-run