Some minor tweaks to the repaint logic.