take timeout as argument