add code to get state