model and persistence refactored