State machine toolbox