added test for neighbors and fixed indexing