Fix up some issues around timeout; add timeout to example code