Plugin context

Closes #991