Implementing GetGrid system function.