Added plugin support, horrible code, but it works