First Modify Code

combine codes together and use new structure, add GUI.