Remove FILE * in function to rid of seg fault