refactor test and code around email downcasing