extract a function
clean up some cruft; latch the 'next state' button so it doesn't run faster than humans can see