private void addNewCode(final String barcode) {

		// separate non-FX thread
		new Thread() {

			@Override
			public void run() {
				// update UI on FX thread
				Platform.runLater(new Runnable() {

					@Override
					public void run() {
						input.setStyle("-fx-background-color: green;");
						input.setEditable(false);
					}
				});

				try {
					// Allow user to spot scanned barcode is correct ;-)
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}

				// update UI on FX thread
				Platform.runLater(new Runnable() {

					@Override
					public void run() {
						int alreadyScanned = 0;
						// add to list if not already added
						if (!codeList.contains(barcode)) {
							codeList.add(barcode);

							// Write new barcode to file
							storage.appendBarcode(barcode);
							// TODO what if writing to file failed?

							alreadyScanned = codeList.size();
							counter.setText(String.valueOf(alreadyScanned));
						} else {
							System.out.println("Taki kod jest już na liście.");
							// TODO Play some sound?
						}
						// scroll listview to make last item visible
						output.scrollTo(alreadyScanned);

						cleanInputAction(null);

						if (alreadyScanned == 3 || alreadyScanned == 5 || alreadyScanned == 10) {
							showPrizeDialog(alreadyScanned);
						}
					}
				});
			}
		}.start();

	}