Added DBController tests. Fixed bugs in DBController.