Rewrite data and state