More work on making the StateMachine generic. Allows the user to create States and the Events that link between with the function to call for that state transition.