This should (theoretically) allow for using the TCP code with a different output type and make it easier to use the JSON code with files / console.