history logging function
added lagrange for potential use later
no real changes
merged