Use immutable local variables where possible.  Otherwise, move var declaration into innermost allowed scope.