anchor.diff:      LOGICAL, INTENT(IN) :: VERBOSE
   
       DOUBLE PRECISION :: DELTAC, OC2, C2NUM, CHI2
  -    DOUBLE PRECISION :: SCALEDOBS
  +    DOUBLE PRECISION :: SUMOBS
  +    DOUBLE PRECISION, DIMENSION(N) :: SCALEDOBS
       INTEGER :: NDX
   
       ! Initialize the update and R factor
       DELTAC = CON / 10.
       CHI2 = 1000000.
   
  +
  +    SUMOBS = 0.
  +
  +    DO NDX = 1, N
  +
  +        SUMOBS = SUMOBS + IOBS(NDX)
  +
  +    END DO
  +
  +    DO NDX = 1, N
  +
  +        SCALEDOBS(NDX) = IOBS(NDX) / SUMOBS
  +
  +    END DO
  +
       DO WHILE ( ( ABS(DELTAC) ) .GT. ( CON / 10000. ) )
   
           OC2 = CHI2
  
positive.code: 
          DO NDX = 1, N
              IF ( ( QOBS(NDX) .LE. QMAX ) .AND. ( QOBS(NDX) .GT. QMIN ) ) THEN
  
                  C2NUM = ( (CON * ICALC(NDX)) -  IOBS(NDX) )**2
                  CHI2 = CHI2 + (C2NUM / IOBS(NDX))
  
              END IF
          END DO
  
negative.code:             DELTAC = DELTAC * (-0.5)
              CON = CON + DELTAC
          ENDIF
              
      END DO
      
      IF (VERBOSE) THEN
  