Added checkEmail function