added very basic event detection algorithms