Extract match logic
Support ** in patterns

References #14.