Reduce the number of UpdateGrid calls, patch by kanetaka