Organized the GUI code