Updated data factory to make the key field optional