anchor.diff:        !! y co-ordinate of the query location
       real(r64),intent(in) :: zQuery
         !! z co-ordinate of the query location
  -    integer(i32), intent(in) :: k
  +    integer(i32), intent(in), optional :: k
         !! Number of points to find that are closest to the query
  +    real(r64), intent(in), optional :: radius
  +      !! Only find neighbours within this distance from the query
       type(dArgDynamicArray) :: kNearest
         !! Indices of the nearest points to the query location
  -    end subroutine
  -    !====================================================================!
  -    !====================================================================!
  -    module subroutine kNearest_KD(search, tree, D, query, k, kNearest)
  +    end function
  +    !====================================================================!
  +    !====================================================================!
  +    module function kNearest_KD(search, tree, D, query, k, radius) result(kNearest)
         !! Overloaded Type bound procedure KdTreeSearch%kNearest()
       !====================================================================!
       class(KdTreeSearch), intent(inout) :: search
  
positive.code: 
    interface
      !====================================================================!
      module subroutine kNearest_2D(search, tree, x, y, xQuery, yQuery, k, kNearest)
        !! Overloaded Type bound procedure KdTreeSearch%kNearest()
      !====================================================================!
      class(KdTreeSearch), intent(inout) :: search
  
negative.code:       !! x co-ordinate of the query location
      real(r64),intent(in) :: yQuery
        !! y co-ordinate of the query location
      integer(i32), intent(in), optional :: k
        !! Number of points to find that are closest to the query
      real(r64), intent(in), optional :: radius
        !! Only find neighbours within this distance from the query
      type(dArgDynamicArray) :: kNearest
        !! Indices of the nearest points to the query location
      end function
      !====================================================================!
      !====================================================================!
      module function kNearest_3D(search, tree, x, y, z, xQuery, yQuery, zQuery, k, radius) result(kNearest)
        !! Overloaded Type bound procedure KdTreeSearch%kNearest()
      !====================================================================!
      class(KdTreeSearch), intent(inout) :: search
  