A smart timeout