adding realtime draw function