Added timeout from #20b4488. Modified to be optional