adding an argument to allow specification of a timeout