modified real to grid function declaration and use