Removed ref to g parameter in init grid function