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