ADDED threshold checking