added hysteresis for new threshold and commented out average good pos command