1)Corrected redraw logic 2) code clean up