I think that Steve mentioned that some of the logic from the "if ( isRegistrationThread() )" part should also be executed as part of the else case.  I think everything but the call to actually clear the session (might be good to hear from Steve on which parts exactly).