Initial transfer and refactoring of code