Improved where grid width is determined