Implemented basic pattern matching.