Big refactoration, split rules in modules, allow multiple rules per input, etc.