cleanup stdout and make it machine readable