Updated grid calculation to account for nested columns