Split out node factory methods to factory.ts