grid in separate func