refactor
refactor
refactor
refactor
refactor
calcGridness