Add state machine and test files