major code cleanup

grid[][].cell -> grid[][].type