dynamic updating of rootName, some rearranging