replaced ternary for readability
Merge branch 'text-serialization-refactor' into full-text-serialization