added redraw function