Added routine to read a state from standard input