Added main code for the plugin