final lbfgs implementation