Part 2, createCodeTree