first attempt at coding a rule-based matcher