added support for optional fields