added beat detection