Added better login functionality