Updated plugin file to save metadata