advanceFrame and branchFrame are now pure Lua.