Adds support for optional fields.

Optional fields are now represented using the scala option type. This closes #7.