anchor.diff:         ENDDO
   
      ENDDO
  -
  -
  -
  -   END SUBROUTINE BD_StaticElementMatrix
  +   CALL Cleanup()
  +CONTAINS
  +   SUBROUTINE Cleanup()
  +      IF(ALLOCATED(gp       ))  DEALLOCATE(gp       )
  +      IF(ALLOCATED(gw       ))  DEALLOCATE(gw       )
  +      IF(ALLOCATED(hhx      ))  DEALLOCATE(hhx      )
  +      IF(ALLOCATED(hpx      ))  DEALLOCATE(hpx      )
  +      IF(ALLOCATED(GLL_temp ))  DEALLOCATE(GLL_temp )
  +      IF(ALLOCATED(w_temp   ))  DEALLOCATE(w_temp   )
  +      IF(ALLOCATED(temp_Nvvv))  DEALLOCATE(temp_Nvvv)
  +      IF(ALLOCATED(temp_Naaa))  DEALLOCATE(temp_Naaa)
  +   END SUBROUTINE Cleanup
  +END SUBROUTINE BD_StaticElementMatrix
   
      SUBROUTINE BD_StaticUpdateConfiguration(uinc,uf,node_total,dof_node)
   
  
positive.code:    REAL(ReKi)                  :: Oe(6,6)
     REAL(ReKi)                  :: Pe(6,6)
     REAL(ReKi)                  :: Qe(6,6)
     REAL(ReKi)                  :: Nvvv(dof_node*node_elem)
     REAL(ReKi)                  :: temp_Naaa(dof_node*node_elem)
     REAL(ReKi)                  :: temp_aaa(6)
     INTEGER(IntKi)              :: igp
     INTEGER(IntKi)              :: i
     INTEGER(IntKi)              :: j
  
negative.code:    END SUBROUTINE BD_GenerateStaticElement
  
     SUBROUTINE BD_StaticElementMatrix(Nuu0,Nuuu,Nrr0,Nrrr,Distr_GL,gravity,&
                                       EMass0_GL,EStif0_GL,ngp,node_elem,dof_node,elk,elf,&
                                       ErrStat,ErrMsg)
  
     REAL(ReKi),    INTENT(IN   ):: Nuu0(:)
     REAL(ReKi),    INTENT(IN   ):: Nuuu(:)
  