Fixed a couple of bugs and added a sample plugin.