Change state() interface
Rewrote unit tests