Adjust implementation to current State class
Allow clearing state
Separate testing of Q construction vs execution
Adjust test case to the new State class