Fixed up so that diagonal resolution does not ignore the edges