refactor the core and design the persistence layer.