added helper function to process the output