refactor, test, test, test. Still need more tests. Should run task in one mode, switch, and then to the manual/random tests as appropriate.