updating api to delete correctly and dispatch events