refactoring, introducing IO interfaces, starting to modify the pickling