updated plugin code