Moved GUI state reading code into a new source file