Just copy from my plagger plugin.