public void backupFile(String filename, int replicationDegree) {
		BackupFile newFile = null;
		byte[] fileHash = computeFileHash(filename);
		
		if(fileHash != null) {
			for(BackupFile file : files) {
				if(Packet.bytesToHex(file.getFileID()).equals(Packet.bytesToHex(fileHash))) {
					System.out.println("File already exists in system");
					return;
				}
			}
			try {
				byte[] buffer = new byte[BackupChunk.maxSize];
				BufferedInputStream reader = new BufferedInputStream(new FileInputStream(filename));
				int bytesRead = 0;
				int prevBytesRead = 0;
				int chunkCount = 0;

				while((bytesRead = reader.read(buffer,0,BackupChunk.maxSize)) != -1) {
					BackupChunk newChunk = new BackupChunk(fileHash, chunkCount, Arrays.copyOfRange(buffer, 0, bytesRead), filename, bytesRead, replicationDegree, 1, null);
					chunkCount++;
					DistributedBackupSystem.tManager.executeTask(TaskManager.TaskTypes.BACKUPCHUNK, newChunk).get();
					prevBytesRead = bytesRead;
				}
				reader.close();
				
				if(prevBytesRead == BackupChunk.maxSize) {
					BackupChunk newChunk = new BackupChunk(fileHash, chunkCount, null, filename, 0, replicationDegree, 1, null);
					chunkCount++;
                    DistributedBackupSystem.tManager.executeTask(TaskManager.TaskTypes.BACKUPCHUNK, newChunk).get();
				}
				
				newFile = new BackupFile(fileHash, filename, replicationDegree, chunkCount);
				files.add(newFile);
				updateLog();

			} catch(Exception e) {
				System.out.println("Error reading file: " + e.toString());
			}
		}
	}