public void releaseSpace() {
        boolean canReleaseMore = false;

        for(BackupChunk chunk : backedUpChunks) {
            if(chunk.getRepDeg() > chunk.getWantedReplicationDegree())
                canReleaseMore = true;
        }

		while(currSize > maxSize || canReleaseMore) {
			BackupChunk maxRepDeg = null;
			
			for(BackupChunk chunk : backedUpChunks) {
				if(maxRepDeg == null || chunk.getRepDeg() > chunk.getWantedReplicationDegree() || (chunk.getRepDeg() > maxRepDeg.getRepDeg() && !(chunk.getRepDeg() > chunk.getWantedReplicationDegree())))
					maxRepDeg = chunk;
			}
			
			if(deleteChunk(maxRepDeg.getFileID(), maxRepDeg.getChunkNo()) == returnTypes.SUCCESS) {
				try {
					DistributedBackupSystem.cManager.sendPacket(new Packet("REMOVED", "1.0", maxRepDeg.getFileID(), maxRepDeg.getChunkNo(), 0, null, null), CommunicationManager.Channels.MC);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}

            canReleaseMore = false;
            for(BackupChunk chunk : backedUpChunks) {
                if(chunk.getRepDeg() > chunk.getWantedReplicationDegree()) {
                    canReleaseMore = true;
                }
            }
		}
	}