completely rewrote the plugin