Fixed bugs, so getNearest now actually works :-)