public void start() throws IOException {
		tManager = new TaskManager();
		fManager = new FileManager();
		cManager = new CommunicationManager(mcastArgs);
		new Thread(cManager).start();

		boolean done = false;
		Scanner console=new Scanner(System.in);
		
		System.out.print("\n\n\n\n");
		System.out.println("DBS v.1.0.0");
		System.out.println("Type 'help' for a list of commands.");
		System.out.println("Type 'quit' to exit.");

		while(!done) {

			String input = console.nextLine();

			if (input.equals("quit")) {
				done = true;
				cManager.finish();
				tManager.finish();
			}
			else if(input.equals("help")) {
				System.out.println("'backup \"filename\" repDegree' to backup a file.");
				System.out.println("'restore \"filename\" ' to restore a file.");
				System.out.println("'delete \"filename\" ' to delete a file.");
				System.out.println("'setAllocatedMemory numberOfBytes' to delete a file.");
				System.out.println("'allocatedMemory' to print the current value for allocated memory.");
				System.out.println("'usedMemory' to print the current value of used up memory.");
				System.out.println("'filesStored' to print the list of files currently in storage.");
				System.out.println("'toggleEnhancements' to toggle usage of enhancements.");
				System.out.println("'quit' to exit the program.");
			}
			else {
				
				
				ArrayList<String> commands = new ArrayList<String>();
				Matcher m = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher(input);
				while (m.find())
				    commands.add(m.group(1).replace("\"", "")); // Add .replace("\"", "") to remove surrounding quotes

				if(commands.size() == 3 && commands.get(0).equals("backup")) {
					try {
						int repDeg = Integer.parseInt(commands.get(2));

						System.out.println("Starting backup...");
						tManager.executeTask(TaskManager.TaskTypes.BACKUPFILE,commands.get(1), repDeg).get();
						System.out.println("done...");
					} catch (Exception e) {e.printStackTrace();}
				}
				else if(commands.size() == 2 && commands.get(0).equals("restore")) {
					try {
						System.out.println("Starting restore...");
						tManager.executeTask(TaskManager.TaskTypes.RESTOREFILE,commands.get(1), 0).get();
						System.out.println("done...");
					} catch (Exception e) {e.printStackTrace();}
				}
				else if(commands.size() == 2 && commands.get(0).equals("delete")) {
					try {
						System.out.println("Starting deletion...");
						tManager.executeTask(TaskManager.TaskTypes.DELETEFILE,commands.get(1), 0).get();
						System.out.println("done...");
					} catch (Exception e) {e.printStackTrace();}
				}
				else if(commands.size() == 2 && commands.get(0).equals("setAllocatedMemory")) {
					try {
						long bytes = Long.parseLong(commands.get(1));
						System.out.println("Starting space reclaiming...");
						tManager.executeTask(TaskManager.TaskTypes.SETMEMORY,null, bytes).get();
						System.out.println("done...");
					} catch (Exception e) {e.printStackTrace();}
				}
				else if(commands.size() == 1 && commands.get(0).equals("allocatedMemory")) {
					System.out.println("The current value for allocated memory is " + fManager.getMaxSize() + " bytes.");
				}
				else if(commands.size() == 1 && commands.get(0).equals("usedMemory")) {
					System.out.println("The current value for used up memory is " + fManager.getCurrSize() + " bytes.");
				}
				else if(commands.size() == 1 && commands.get(0).equals("filesStored")) {
					System.out.println("Files currently in storage:");
					System.out.println("Filename      Replication Degree      Number of Chunks");
					DistributedBackupSystem.fManager.printAllFiles();
				}
				else if(commands.size() == 1 && commands.get(0).equals("toggleEnhancements")) {
					if(enhancementsOn) {
						enhancementsOn = false;
						System.out.println("Enhancements are not in use.");
					}
					else {
						enhancementsOn = true;
						System.out.println("Enhancements are in use.");
					}
				}
				else {
					System.out.println("Unknown command. Type 'help' for a list of commands.");
				}
			}
		}
		console.close();
	}