Group output data if possible