finished inputhistory.js