Algorithm complete except check for root