Implemented neighborsWithHistory