Fixing the grid spacing and some code formatting