Trimming code
Added dymanicly sized grid.