Improving dual-tree algorithms