Added inState test and code