Segregate data in rewriting

**do not review yet**