Use more intelligent node factories, less duplicate code