Fixes #2977: remove <type> <action> from header in output and a big of output-related cleanup