Added support for Option to Macros

The encode and decode macros now support the Option type.

This closes #144.
I have moved the code into a separate function that takes in the context as parameter.