Add support for plugins. Fixes #1