Modification to expandCounts.