public UIThread() throws Exception {
        // ask user for configuration file
        configuration_filename = getInput("Welcome, please enter the path of configuration file:", "Welcome", JOptionPane.INFORMATION_MESSAGE);

        // read configuration file
        BufferedReader in = new BufferedReader(new FileReader(configuration_filename));

        // parse YAML
        Constructor constructor = new Constructor(Configuration.class);
        TypeDescription carDescription = new TypeDescription(Configuration.class);
        carDescription.putListPropertyType("configuration", Configuration.Host.class);
        carDescription.putListPropertyType("sendRules", Configuration.Rule.class);
        carDescription.putListPropertyType("receiveRules", Configuration.Rule.class);
        carDescription.putListPropertyType("groups", Configuration.Group.class);
        constructor.addTypeDescription(carDescription);
        Yaml yamlParser = new Yaml(constructor);

        configuration = (Configuration) yamlParser.load(in);
        configuration.initialize();
        //hostnameList = new String[configuration.configuration.size()];
        hostnameList1 = new String[configuration.groups.size()];
        newMsgHostnameList = new String[configuration.groups.size()];
        displayedHostnameList = new String[configuration.groups.size()];
        
        option.put(clocks[0], Clock.LOGICAL);
        option.put(clocks[1], Clock.VECTOR);

        // ask user for local name
        localName = getInput("Welcome, please enter your local name:", "Welcome", JOptionPane.INFORMATION_MESSAGE);
        // check if user is valid
        while (!configuration.hostMap.containsKey(localName)) {
            localName = getInput("Invalid local name\nPlease enter your local name:", "Welcome", JOptionPane.WARNING_MESSAGE);
        }

        int i = 0;
        for (Group host : configuration.getMyGroups(localName)) {
            if (host.name.equals(localName)) {
                displayedHostnameList[i] = String.format("%s (youself)", host.name);
            } else {
                displayedHostnameList[i] = host.name;
            }

            hostnameList1[i] = host.name;
            newMsgHostnameList[i] = String.format("%s (new message!)", displayedHostnameList[i]);
            hostnameMap.put(host.name, new Integer(i++));
        }
        for (Configuration.Host host : configuration.configuration) {
           hostnameList.add( host.name);
            }
        ArrayList<String> tempArr = new ArrayList<String>();

        for (String host : hostnameList1) {
            dialogMap.put(host, new StringBuffer());
            tempArr.add(host);
        }
        
       
        
        Clock c = option.get(getClock("Select Clock", "Welcome", JOptionPane.INFORMATION_MESSAGE, clocks));
        System.out.println(c);
        System.out.println("hostnameList :"+hostnameList);
        clockService = ClockFactory.getClockService(c, localName, hostnameList);
        mp = new MessagePasser(statusArea,configuration_filename, localName, clockService);
     
        // register watcher for configuration file
        confFile = new File(configuration_filename);
        confPath = Paths.get(confFile.getParentFile().getPath());
        watcher = FileSystems.getDefault().newWatchService();
        try {
            WatchKey key = confPath.register(watcher, ENTRY_MODIFY);
        } catch (IOException x) {
            System.err.println(x);
        }
        
        initialize();

        // start background receive thread
        (new Thread(new ReceiveThread(mp))).start();
    }