very unDRY way of getting the output formatted