added beat detection section