Pattern matching

TODO: add term