Added support for a 'timeout' parameter.