Updated code to resolve various persistence issues.