Deserialization and printing refactoring.