I think a massive rule rewrite is in order...