Fixed bug in nearest neighbors, moved order of box