Small efficiency improvement to drawLayers() method