added support for id generation in factory