Created the outer skeleton for the state machine

- All case statements are added
- Inputs and outputs are almost encoded
- Some states are finished