Refined the login mechanism