Factored out specification code
Changed to be slightly more consistent
Adding stdout and stderr streams to JSON output