added local grid calculations