Code nearly complete, need to fix root sorting