some additions for grids and sampling