Cleaning for rewrite