Moved Timeout implementation into its own co-routine in order to support termination correctly.