more logic setup of pattern detection and action