Move shared code to subtree