Adding timeout mechanism