Move to Enums for states and triggers

FSM now takes two type args, one enumeration of triggers and one of
possible states. Simplified a lot of the code.