added better login validation