updated plugin with callbacks