begin writing pattern matching