Added state machine and memory.