Rewrite plugin using functional inheritance

Inspired by Javascript: The Good Parts.