finalizing the output