Add support for optional plugins

Trimming isn't strictly required here.