Pretty printer refactored