Extracted the output to stdout function