Copying root code

Basic modifications to use RAX.