public static void main(String argv[]) throws Exception {
		final long startTime = System.currentTimeMillis();
		String inputFileName = argv[0];
		final String outputFileName = argv[1];
		int threadsCount = 4;
		if (argv.length > 2) {
			threadsCount = Integer.parseInt(argv[2]);
		}

		GridFactory gridFactory = new FromFileGridFactory(inputFileName);
		Grid grid = gridFactory.createGrid();
		final GridProcessingManager gpm = new GridProcessingManager(
				threadsCount);
		gpm.setInitialGrid(grid);
		gpm.setMaxTries(grid.getDistanceToTarget() + 111111);
		// Well this is a nasty dirty hack to be sure we don't run more than 2
		// minutes
		Timer timer = new Timer();
		timer.schedule(new TimerTask() {
			@Override
			public void run() {
				//System.out.println("timer here");
				try {
					gpm.stop();
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}, 1 * 60 * 100 - 200);
//		System.out.println("started");
		gpm.start();
		timer.cancel();
		gpm.stop();
//		System.out.println("after started");
		
		executeFinalStep(outputFileName, gpm);

		long endTime = System.currentTimeMillis();
		
		System.out.println("Time spent:" + (endTime - startTime));
	}