Paste and adjust all  old code