model/persistence refactoring and cleanup.