Json deserializer and code refactoring.