Refactor handling of root nodes on server-side to allow node ordering