add case class and pattern matching