Added threshold conditions