changed the grid to a 2D array of unsigned chars, resulted in a small performance improvement