Extracted as a plugin and added an example file.