updated node factory mechanism to support caching (in the default implementation) and made it so that a custom implementation could be provided