added lbfgs code from ufuk