added gridArray function