Added grid type argument.