State machine mostly complete