finish implement neighborsWithHistory