Got rid of global file pointers