Move test file functionality into its own function
Move filesystem functionality into its own function