Updated plugin to use the API