#7: Updated operation state machine
#7: Added more states to machine