Refactoring the file export functionality to make it more consistent
Adding more unit tests to increase coverage