fixed some of the tests to work properly, also renamed the function that writes a directory to a file to make it more clear what it does