Some minor adjustments
Added the decoder state machine
A minor adjustment
State machines logic adjustments