Add support for optional dependencies

Closes #3.