Added listener for custom _id generation