There is no need to do this block of code unless id_root is None, correct? Why not move the if up higher?