updated grid.* to follow google style, some other minor changes