add functionality for flush cache and redraw