refactor to a plugin
Merge pull request #16 from segmentio/refactor/plugin

refactor to a plugin