add test for undefined options
wrap everything to avoid leaking variables
update documentation
Merge branch 'master' into gh-pages