improve file module, almost done