basic threshold working now, via global variable