now made DB optional, added new test cases