Dynamically generating root node per frame, restructured program flow a bit