Added checks to prevent account lockouts.