Code cleanup + added optional query for block grids progressive enhancement