anchor.diff:                  |> fun m -> Matrix.getCol m 0
                   |> Vector.norm
                   |> fun x -> x*x
  -            let rho = 1.0
  -            let tr = I - (rho * (A_tild lambd)) |> getDiag |> Vector.sum
  +            let rho = 1.3
  +            let tr = I - (rho * (A_tild lambd)) |> Matrix.getDiag |> Vector.sum //
               (float n) * no / (tr)  
       
           //NelderMeadSolver for global minimum
  -        let lambda_hat = NelderMead.minimizeSingleWith V_tild 3. 0.0001 2000.    
  +        let lambda_hat = 
  +            //let lamlist = [for i = 0 to 64 do yield 0.01*(1.2**(float i))]
  +            //lamlist
  +            //|> List.map V_tild
  +            //|> List.min
  +            NelderMead.minimizeSingleWith V_tild 3. 0.0001 2000.    
           
           let variance_unconstrained = Var_tild lambda_hat
           let GCV_unconstrained = V_tild lambda_hat
           let a_unconstrained = a_star lambda_hat
  -        let c' =         
  +        let c =         
               let tmpH = H
               let tmpD = D
               let tmp = 
                   let tmp' = Algebra.LinearAlgebra.SolveLinearSystems tmpD tmpH
                   tmp' * a_unconstrained
               Vector.init (tmp.Length+2) (fun i -> if i>0 && i<=tmp.Length then tmp.[i-1] else 0.0)
  -        variance_unconstrained,GCV_unconstrained,a_unconstrained,c'
  -    
  -    let getInitialEstimateOfWXY W (y:Vector<float>) (x:Vector<float>) =
  +
  +        let getShape = getExtrema xVal a_unconstrained c
  +
  +        let aic = getAIC (float getShape.Length) a_unconstrained y W
  +
  +        ///function that calculates the y_Value of the spline corresponding to the given x_Value
  +        let splineFunction = initEvalAt xVal a_unconstrained c
  +
  +        createTempClassResult a_unconstrained c 0. GCV_unconstrained 0. (Array2D.zeroCreate 0 0) aic splineFunction
  +    
  +    ///calculates an unconstrained smoothing spline for a given weightingmatrix, x-, and y-Values
  +    let getInitialEstimateOfWXY W (y:Vector<float>) (xVal:Vector<float>) =
           let n = y |> Seq.length
       
  -        let h = Array.init (n-1) (fun i -> x.[i+1] - x.[i] )
  +        let h = Array.init (n-1) (fun i -> xVal.[i+1] - xVal.[i] )
           let H = Array2D.zeroCreate (n-2) n
           let D = Array2D.zeroCreate (n-2) (n-2)
           for i = 1 to (n-2) do
  
positive.code:                     Matrix.setRow Ctemp (4*i-3) (B.Row (i-1) |> vector)
                      Matrix.setRow Ctemp (4*i-2) (temp - (B.Row (i-1) |> vector))
                      Matrix.setRow Ctemp (4*i-1) (temp - (B.Row (i) |> vector))
                  [|Ctemp|]
  
              elif (con=1) then
  
negative.code:                             Matrix.setRow Ctemp (4*i-1) (- (temp - (B.Row (i) |> vector)))
                              if i = j - 1 then
                                  Matrix.setRow Ctemp (4*i-4) (Vector.zero Ctemp.NumCols)
                                  Matrix.setRow Ctemp (4*i-3) -(B.Row (i-1) |> vector)
                                  Matrix.setRow Ctemp (4*i-2) (Vector.zero Ctemp.NumCols)
                                  Matrix.setRow Ctemp (4*i-1) (Vector.zero Ctemp.NumCols)
                          for i = j to n-1 do
  