Fixing bug with reseting the state machine and adding a status checker for state...