Moved State init and unint to constructor and deconstructor.