better code structure for threshold