genericize printData, add collection param