Converted pseudo for cfg traversal into actual code.