compact the result