A little cleaning, added missing nearpoints func