added own version of the uniform grid for efficiency improvements