Improved queryKD speed by factor 5.