implove handling of files