state 0 to  7