Finished basic structure for a finite state machine, should do the job I guess :/