Changed (unused) algorithm to threshold at 5th percentile instead of average