Improved login, history.js