final db working