Refactoring the constructor so it can get IWriter as a parameter,