Implemented needRedraw to avoid excessive redrawing of windows.