returning promises from factory