Finish memory rewrite and code adjustment