move more functions in file.c