the GUI begins to work, begun to re-organize the code