Reset state + valid constraint

* Reset state on invalid input
* Add constraint validation