anchor.diff:                 m%SDWrOutput(I) = y%WriteOutput(I)            
               END IF                        
            END DO
  -         
            m%LastOutTime   = t
  -                  
         ENDIF           
     
   CONTAINS
  +   LOGICAL FUNCTION Failed()
  +        call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'SD_CalcOutput') 
  +        Failed =  ErrStat >= AbortErrLev
  +        if (Failed) call CleanUp()
  +   END FUNCTION Failed
  +   
      SUBROUTINE CleanUp
  -   
          CALL SD_DestroyContState( dxdt, ErrStat2, ErrMsg2)
  -       
      END SUBROUTINE CleanUp
  +
   END SUBROUTINE SD_CalcOutput
   
   !----------------------------------------------------------------------------------------------------------------------------------
   !> Tight coupling routine for computing derivatives of continuous states
   !! note that this also sets m%UFL and m%udotdot_TP
   SUBROUTINE SD_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg )
  -!..................................................................................................................................
  -
         REAL(DbKi),                   INTENT(IN   )  :: t           !< Current simulation time in seconds
         TYPE(SD_InputType),           INTENT(IN   )  :: u           !< Inputs at t
         TYPE(SD_ParameterType),       INTENT(IN   )  :: p           !< Parameters
  
positive.code:    TYPE(MeshType),            INTENT( INOUT ) :: outputMesh
     INTEGER(IntKi),            INTENT(   OUT ) :: ErrStat                   ! Error status of the operation
     CHARACTER(*),              INTENT(   OUT ) :: ErrMsg                    ! Error message if ErrStat /= ErrID_None
     
    
     INTEGER         :: I                 ! generic counter variable
     INTEGER         :: nodeIndx
     
  
negative.code:     end function
  
  END FUNCTION MemberLength
  
  !------------------------------------------------------------------------------------------------------
  !> Calculate member mass, given properties at the ends, keep units consistent
  !! For now it works only for circular pipes or for a linearly varying area
  FUNCTION MemberMass(rho1,D1,t1,rho2,D2,t2,L,ctube)
      REAL(ReKi), INTENT(IN)                :: rho1,D1,t1,rho2,D2,t2 ,L       ! Density, OD and wall thickness for circular tube members at ends, Length of member
      !                                                     IF ctube=.FALSE. then D1/2=Area at end1/2, t1 and t2 are ignored
      REAL(ReKi)              :: MemberMass  !mass
  