modified by Dimitry

Bugfixing and modified the plugin