public WadSort(String... arguments) throws Exception {
        try {
            log("");
            log("Processing started, determining filenames");
            if (checkParameters(arguments)) {
                log("Filenames identified: " + inputFilename + " " + sortedOutputFilename + " " + histogramOutputFilename);

                log("preparing input and output streams");
                prepareReadersAndWriters();
                log("Streams ready");

                log("Beginning to absorb data from " + inputFilename);
                NumberSponge sponge;
                switch (mode) {
                    case TRIVIAL:
                        log("WARNING! Trivial mode enabled, output invalid");
                        sponge = new NumberSpongeTrivialImpl();
                        break;
                    case ACTUAL:
                        sponge = new NumberSpongeImpl();
                        break;
                    default:
                        throw new Exception("unknown mode");
                }
                try {
                    String lineRead = inputReader.readLine();
                    while (lineRead != null) {
                        sponge.absorb(Integer.parseInt(lineRead.trim()));
                        lineRead = inputReader.readLine();
                    }
                } catch (IOException e) {
                    throw new Exception("Something went wrong while reading data", e);
                }
                log("Absorbed " + sponge.getNumUniqueAbsorbedValues() + " values");

                log("Writing sorted data to " + this.sortedOutputFilename);
                sponge.writeSortedData(sortedWriter);
                log("Sorted data written");

                log("Writing histogram data to " + this.histogramOutputFilename);
                sponge.writeHistogramData(histogramWriter);
                log("Histogram data written");

                log("Processing completed successfully");
            } else {
                logError("Processing stopped, could not determine filenames");
            }
        } finally {
            attemptToCloseStreams();
        }
    }