cleanup and added some TODOs.
check for null values when serializing.