delete the useless code
added the state machine
added the state machine
added the parse part