Code Rewrite