optimize the output.