Added optional struct fields and option encoding/decoding