file reading improved