Neighbors function implemented.