working toward a proper state machine