Made redraw only when window shrinks. Working on a better solution