Preparing the data for output