Improved stdout parsing