added a get state function