finished up some of the functions necessary to get the Lagrangian