adding global variables to read file function