Adds support for optional fields.

Optional fields are now represented using the scala option type. This closes #7.
also, a question for my own understanding: this is the method to serialize the type? And the type is serialized in a sparse format, where for every existing field we write down both the field name and it's value, and for every missing field we just have nothing?