private void search() {
		if (isSearching) {
			return;
		}
		isSearching = true;
		new Thread(new Runnable() {

			@Override
			public void run() {
				model.setComStatus(SafeModel.COM_STATUS_SEARCHING);
				ArrayList<String> ports = model.getPorts();

				String lastComPort = model.getLastSerialPort();
				if (lastComPort!=null && !lastComPort.equals("")) {
					System.out.println("Connecting to: "+lastComPort);
					model.setConnect(connect(lastComPort));
				}
				if (model.isSafe()) {return;}
				for (String port:ports) {
					if (!lastComPort.equals(port)) {
						if (!model.getSearch()) {break;}
						System.out.println("Connecting to: "+port);
						model.setConnect(connect(port));
						if (model.isSafe()) {
							break;
						}
					}
				}
				model.setSearch(false);
				if (!model.getConnect()) {
						model.setComStatus(SafeModel.COM_STATUS_NONE_FOUND);
						System.out.println("No safe has been found!");
				}
			}
			
		}).start();
	}