Adding code to handle different kinds of grids, and still working on handling warp-around grid subsampling