Updated API and replaced deprecated events