Added rootNodes list to enhance complexity, add more tests