Completed rewrite