Split out processing, cleanup, and resetting
Split out determining the timeout delay
Split out creating a timeout