flat file persistence refactoring