Added `isFactory` options to indicate that the function returns the service object.