Make kdtree use any underlying type,
Add more info in exceptions.