implement as OOP, use config files for filenames, db info etc