Minor refactoring of kryo writer.
Merge remote-tracking branch 'origin/master'