refactor Email class to case class