Clean up some old state-machine code.