refactoring + fix for list pickling bug