Replaces try: getattr() with getattr and defaults
Moves following redirects to separate function.

This is just a cut n' paste refactoring of run_sequence. Extracts a loop
to separate function. Used variables either given as arguments to the
function or returned if they are created in the loop.