Added tests to finish all these database shenanigans