persistence refactor