To really take advantage of the hierarchical structure, we used single template to design (pseudo code) all of the state machines. The general approach started with drawing out the state machines using state charts. Once we defined a state, we first filled in the During function, which contains entry, exit, and event responses. Next we wrote the start characteristics such as conditional or normal entry. Last, we wrote the state transitions in the run function.