refactor to allow computation of Moran's I