Fixed ref counting
Use external comparitor in k-ary tree