public void SwapBars(int i, int j)
 {
     //if closing dont update ui
     if (close)
     {
         return;
     }
     //highlight the two swapping bars
     Output.StartHighlightBar(i);
     Output.StartHighlightBar(j);
     //if not stepping, wait
     if (!stepping)
     {
         System.Threading.Thread.Sleep(Output.time);
     }
     //remove the previous bars and redraw in new positions
     Output.ClearBar(i);
     Output.ClearBar(j);
     Output.SwapBars(i, j);
 }