Finised the plugin. Not very well tested, but should work