Implemented L-BFGS algorithm