Working counters with orddict
Change ctr_refs:value to use orddict:fold