pattern matchin and case classes