Small code restructuring; Initial work on persistence framework.