Beginning of adaptive grid and test functions..