calculate extrema on the fly, use set-based queue [sic], N in Stats
Merge branch '1320_patterns' into arlington