REFACTORING: rewrite rules and proxy.