Updated timeout code