modular ports rewrite