corrected threshold calculation