Move state into the controller class
Fixup tests