The return of the plugin

Some comments would be welcome in the code below.  At the moment it's totally mystifying.