using snprintf instead
using thresholds