version 1.2: rewrote to allow multiple instances of plugin with different settings