Rewrite of relation and state changes