still working on Lagrange formulation