Added minor "painting" optimization