Added validation in login and refined login