Fixed bug in SolutionWriter test folders

More refactoring and added tests
More refactoring