pass timeout (in milliseconds) as optional parameter