Improved login message logic