Added demo, fixed a bug in _changeState and added mocking of requests