improve login functionality