added subgrid functionality