Sped up copy_treemodel, and cleaned up naming and comments.