Merge pull request #25 from sun/rewrite

Rewritten: plugin architecture