event detection added, modified api