added printState() method