improved login mechanism