Updated use of promise factory.