Added a state system