k-d tree impl & tests