Finished database handler and tests for it