Modified login. Improved model