slightly modified history.js