cleaned up login.js a bit