Move history functions into window.UserHistory