add support for default values

Also add an example for the docs.

Fixes #1