FSM rewrite

A work in progress on rewriting the wavefunction controller code in the MVC pattern with a finite state machine as the controller. 

Current bugs:
- Events still trigger actions to be performed, even if they shouldn't. I possibly have to rewrite the code to perform the action on a transition, not on the actual event