Move a super-complicated constructor out into a static factory.