Refactor timeout