Cleanup
Add duration to history and ajax