Closure support for plugins

Plugins can add hooks in the form of Closures to speed up develoment of
smaller plugins.