output formatting stage