add total_timeout support, and implement a number more tests.