Yuck! You're defining a totally unrelated extractor in the companion object of a case class!
Put this in an inner object.