Clean up somewhat. Make grain size a run-time value. Use char * instead of int where feasible when doing arithmetic on pointers. Still not as portable as I might wish - it depends on storing flags in the low two bits of pointers, for example - but way better than it was.