Improving login validation