Pull code to get file into separate function
Pull out put of file into separate function