extract stats helper and sort by source