More grid work + code cleanup.