Refactored arguments, added file-writer, print and tests.