Not printing anything if there is no captured stdout.

Also cleaned up a bad test
Tidied up formatting logic a bit