some organization and fixed getDb()