Fixes ##12555: Rearrange variables to place grids and containers closer