modular grid calculations