anchor.diff:        TYPE(SD_MiscVarType),         INTENT(INOUT)  :: m           !< Misc/optimization variables
         INTEGER(IntKi),               INTENT(  OUT)  :: ErrStat     !< Error status of the operation
         CHARACTER(*),                 INTENT(  OUT)  :: ErrMsg      !< Error message if ErrStat /= ErrID_None
  -
  -
  -
  -         ! Initialize ErrStat
  -         
  +      ! Initialize ErrStat
         ErrStat = ErrID_None         
         ErrMsg  = ""               
  -      
  -      
  -         ! Place any last minute operations or calculations here:
  -
  -
  -         ! Close files here:     
  -                  
  -                  
  -
  -         ! Destroy the input data:
  -         
  -      CALL SD_DestroyInput( u, ErrStat, ErrMsg )
  -     
  -
  -         ! Determine if we need to close the output file
  -         
  +
  +      ! Determine if we need to close the output file
         IF ( p%OutSwtch == 1 .OR. p%OutSwtch == 3 ) THEN   
            IF ((m%Decimat .EQ. p%OutDec) .OR. (m%Decimat .EQ. 0))  THEN
                  ! Write out the last stored set of outputs before closing
               CALL SDOut_WriteOutputs( p%UnJckF, m%LastOutTime, m%SDWrOutput, p, ErrStat, ErrMsg )   
            ENDIF
  -         
            CALL SDOut_CloseOutput( p, ErrStat, ErrMsg )         
         END IF 
  -         
  -         ! Destroy the parameter data:
  -         
  -      
  +      
  +      ! Destroy data
  +      CALL SD_DestroyInput( u, ErrStat, ErrMsg )
         CALL SD_DestroyParam( p, ErrStat, ErrMsg )
  -
  -
  -         ! Destroy the state data:
  -         
         CALL SD_DestroyContState(   x,           ErrStat, ErrMsg )
         CALL SD_DestroyDiscState(   xd,          ErrStat, ErrMsg )
         CALL SD_DestroyConstrState( z,           ErrStat, ErrMsg )
         CALL SD_DestroyOtherState(  OtherState,  ErrStat, ErrMsg )
  -         
         CALL SD_DestroyMisc( m,  ErrStat, ErrMsg )
  -
  -         ! Destroy the output data:
  -         
         CALL SD_DestroyOutput( y, ErrStat, ErrMsg )
   
  -
  -      
  -
   END SUBROUTINE SD_End
  -!------------------------------------------------------------------------------------------------------
   
   !----------------------------------------------------------------------------------------------------------------------------------
   !> This subroutine implements the fourth-order Adams-Bashforth Method (RK4) for numerically integrating ordinary differential 
  
positive.code:    CHARACTER(*),            INTENT(  OUT)  :: ErrMsg    ! Error message if ErrStat /= ErrID_None
  ! local variable for input and output
  CHARACTER(1024)              :: PriPath                                         ! The path to the primary input file
  CHARACTER(  12)              :: JunkStrg                                        !Temp variable to store a short string  -RRD
  CHARACTER(1024)              :: Line                                            ! String to temporarially hold value of read line
  INTEGER                      :: Sttus
  
  
negative.code:    
           x%qmdot = x%qmdot + (p%SDDeltaT / 24.) * ( 9. * xdot_pred%qmdot + 19. * OtherState%xdot(1)%qmdot - 5. * OtherState%xdot(2)%qmdot &
                                            + 1. * OtherState%xdot(3)%qmdot )
           CALL SD_DestroyContState( xdot_pred, ErrStat, ErrMsg) ! local copy no longer needed
        else
           x%qm    = x_pred%qm
           x%qmdot = x_pred%qmdot
        endif
  
        CALL SD_DestroyContState( x_pred, ErrStat, ErrMsg) ! local copy no longer needed
  