Further refactoring and introduced PrettyPrinter code.