Support redirects and returns in actions

Also fixes dynamic marking for unvisited nodes.