finished finate state mashine