Added optional timeout to HTTP requests