some more reworkig the rewrite stuff