A proper state machine for Objective-C.