Compacted code; fixed a couple minor bugs re: matchRules