Added plugin factory method to create plugins.