Split up the cloning functions into two. With tests.