add routine to compress rows