Refactor file db.