Updated plugin code