refactored DB control file