improvements to the collate script.