added support for data field to be optional