Small improvements to file code