fully functioning code that provides redraws