Serialization changes for optimization. Still need to add junit test, but for this it doesn't look like a blocker.