added db unit-test and made other tests clearer